package com.youlai.eng.repository;

import com.youlai.eng.entity.EngBuyerEntity;
import com.youlai.eng.entity.EngSalemanEntity;
import org.apache.ibatis.annotations.Param;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface EngSalemanRepository extends JpaRepository<EngSalemanEntity,Long>, JpaSpecificationExecutor<EngSalemanEntity> {
    //JPA方法名命名规则
    public EngSalemanEntity findTopById(Long id);

    // 这是HQL :xx 指传入参数，跟下面注解@Param对应
    //@Query(value = "SELECT s FROM SysOrgEntity s WHERE orgName=:orgName")
    //List<SysOrgEntity> findByOrgName(@Param("orgName") String orgName);

    // 原生SQL  nativeQuery为true代表使用SQL语言
    @Query(value = "SELECT * FROM bee_eng_saleman WHERE saleman_name=?", nativeQuery = true)
    public List<EngSalemanEntity> findBySalemanName(@Param("salemanName") String salemanName);

    //List<SysOrgEntity> findAllById(List<Long> ids)


}

